export default {
    /**
     * 流程启动配置
     * @param context
     * canStartFlow:res.canStartFlow,
     * instId:res.data.INST_ID_,
     * bpmDefId:res.formSolution.flowDefId,
     * instStatus:res.data.INST_STATUS_ CANCEL,DRAFTED
     * pkId:""
     */
    startFlow:function (context){
        return context.canStartFlow;
    },
    newSubmit:function (context){
        if(context.pkId){
            return true;
        }
        return false;
    },
    /**
     * 配置了流程定义，不显示暂存按钮
     * @param context
     * @returns {boolean}
     */
    staging:function (context){
        let flowDefJson=context.formSolution.flowDefMapping;
        if(flowDefJson){
            let flowDefMapping=JSON.parse(flowDefJson);
            if(flowDefMapping.length>0){
                return false;
            }
        }
        return true;
    },
    bpmPreview:function (context){
        return context.canStartFlow && !context.pkId;
    },
}
